-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate docs for the CLI #40
Conversation
This POC provides a new command (`usage`) that is hidden from users, but would allow us to CD docs as part of our workflow.
Codecov Report
@@ Coverage Diff @@
## master #40 +/- ##
==========================================
- Coverage 39.39% 39.17% -0.22%
==========================================
Files 12 13 +1
Lines 853 878 +25
==========================================
+ Hits 336 344 +8
- Misses 493 510 +17
Partials 24 24
Continue to review full report at Codecov.
|
Pending review, this has been deployed here: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a missing commit to the .toml file listing dependencies?
cmd/usage.go
Outdated
return true | ||
} | ||
|
||
func usage(cmd *cobra.Command, args []string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’d rather we did the call to Pandoc from outside go. I’d like to generate the .md content from go, and the exit.
Then in config.yml call out to pandoc to generate HTML.
.circleci/deploy-gh-pages.sh
Outdated
|
||
# move index and update links | ||
mv circleci.html index.html | ||
sed -i -- 's#<a href="circleci.html">#<a href="index.html">#g' *.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you do this moving and replacement from somewhere else, so that you his script is just concerned with pushing to gh-pages.
Having these two lines in the middle of this script is surprising to the reader.
cmd/root.go
Outdated
@@ -13,6 +13,8 @@ import ( | |||
|
|||
var defaultEndpoint = "https://circleci.com/graphql-unstable" | |||
|
|||
var rootCmd *cobra.Command |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you make a global here?
We now generate the markdown comment from `usage` command, and call pandoc from a script to handle generating HTML.
The changes to I will have to check which version of |
After further review, it looks like the change to Which seems to have been released about 10 days ago: |
|
||
# pandoc markdown to html into out dir | ||
for f in docs/*.md; do | ||
pandoc "$f" -s -o "out/$(basename ${f%.md}.html)"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bit of magic was in their FAQ 🙌
https://pandoc.org/faqs.html#how-can-i-convert-a-whole-directory-of-files-from-markdown-to-rtf
You can see a preview here:
https://852-137903064-gh.circle-artifacts.com/0/docs/circleci.html
Which was generated by this build:
https://circleci.com/gh/CircleCI-Public/circleci-cli/852#artifacts/containers/0